function sendResult(obj) {
    var httpRequest = new XMLHttpRequest();
    httpRequest.open('POST', 'url', true);
    httpRequest.setRequestHeader("Content-type", "application/json");
    httpRequest.send(JSON.stringify(obj));
}

function vex_draw(notes, keySignature) {
    var vf = new Vex.Flow.Factory({ renderer: { elementId: 'vex', width: 300, height: 300 } });
    var stave = vf.Stave({ y: 50 })
    notes = notes.map(vf.StaveNote.bind(vf));
    var voice = vf.Voice()
        .setMode(Vex.Flow.Voice.Mode.SOFT)
        .addTickables(notes);
    // add 谱号 拍号 调号
    stave.addClef(notes[0].clef).addTimeSignature('4/4').addKeySignature(keySignature);
    Vex.Flow.Accidental.applyAccidentals([voice], keySignature); // 根据调号修改
    new Vex.Flow.Formatter()
        .joinVoices([voice])
        .formatToStave([voice], stave);
    vf.draw();
}

/** @timer */
function createT(finishFunc = _finish) {
    var pg = document.getElementById('pg')
    pg.value = 0;
    var timer = setInterval(function () {
        if (pg.value !== 50) {
            pg.value++
        } else {
            clearInterval(timer);
            finishFunc(timer);
        }
    }, 45);
    return timer;
}

function getTvalue(timer) {
    clearInterval(timer);
    return document.getElementById('pg').value;
}

function _finish() {
    console.log('timer加载完成');
}
/**  */




